/*
	Copyright (C) 2009 Salil Bhagurkar
	
	This file is part of ViSE
	
	ViSE is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	ViSE is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.
	
	You should have received a copy of the GNU Lesser General Public License
	along with ViSE.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <shared.h>

#define MEMALIGN 4

static void *memptr;

void *malloc(u32 sz)
{
	void *ret;
	u32 x;
	x = sz / MEMALIGN * MEMALIGN;
	if(x < sz)
		sz = x + MEMALIGN;
	ret = memptr;
	memptr += sz;
	memset(ret, 0, sz);
	return ret;
}

int free(void *mem)
{
	return 0;
}

void init_malloc()
{
	memptr = (void *)arch_kernel_end;
}
